package com.example.cloudproviderorder80.service;

import com.example.api.entity.CommonResult;
import com.example.api.entity.Payment;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

@Component
//@FeignClient(name = "CLOUD-PAYMENT-SERVICE", fallback = HystrixClientFallback.class)
@FeignClient(name = "CLOUD-PAYMENT-SERVICE", fallbackFactory = HystrixClientFallbackFactory.class)
public interface PaymentFeignService {
    @HystrixCommand()
    @GetMapping("/payment/{id}")
    CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/payment/feignTimeout")
    String feignTimeout();

    @GetMapping("/payment/feignException")
    String feignException();
}
